#include "msgCore.h"
#include "nsExchangeIncomingServer.h"
#include "nsExchangeMailFolder.h"

NS_IMPL_ISUPPORTS_INHERITED1(nsExchangeIncomingServer,
			    nsMsgIncomingServer,
			    nsIExchangeIncomingServer)

nsExchangeIncomingServer::nsExchangeIncomingServer()
{
    m_localStoreType = "exchange";
}

nsExchangeIncomingServer::~nsExchangeIncomingServer() {}

nsresult
nsExchangeIncomingServer::GetLocalStoreType(nsACString& type)
{
  type = m_localStoreType; // see nsMsgIncomingServer::CreateRootFolder()
  
  return NS_OK;
}    

NS_IMETHODIMP
nsExchangeIncomingServer::SetLocalStoreType(const char *type)
{
     NS_ENSURE_ARG(type);
     m_localStoreType = type;
     return NS_OK;
}

nsresult
nsExchangeIncomingServer::CreateRootFolderFromUri(const nsCString &serverUri, nsIMsgFolder **rootFolder)
{
  nsExchangeMailFolder *newRootFolder = new nsExchangeMailFolder;
  if (!newRootFolder)
    return NS_ERROR_OUT_OF_MEMORY;
  newRootFolder->Init(serverUri.get());
  NS_ADDREF(*rootFolder = newRootFolder);
  return NS_OK;
}
